#include "LittleRan.h"
#include <windows.h>

//openssh
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/bio.h>

#pragma comment(lib, "libeay32.lib")
#pragma comment(lib, "ssleay32.lib")


std::string LittleTools::EncryptTools::CryptoRASEncodeWithPublic(std::string EncryptMsg, std::string PublicKey, bool EncryptUtf8 /* = false */, bool TransformB64 /* = true */)
{
	

	return "123";
}




std::string LittleTools::EncryptTools::CryptoRASDecodeWithPrivate(std::string DecryptMsg, std::string PrivateKey, bool EncryptUtf8 /* = false */, bool TransformB64 /* = true */)
{
	//Reader prv key
	char* chPrivateKey = const_cast<char *>(PrivateKey.c_str());
	//
	BIO*      bio = nullptr;
	RSA*      rsa = nullptr;
	bio = BIO_new_mem_buf(chPrivateKey, -1);
	if (nullptr != bio){
		rsa = PEM_read_bio_RSAPrivateKey(bio, NULL, NULL, NULL);
		if (nullptr != rsa){

			RSA_free(rsa);
		}
		BIO_free_all(bio);
	}

	return "321";
}